<?xml version="1.0" encoding="utf-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <choice>
      <choice>
        <choice>
          <ref name="element1"/>
          <ref name="element2"/>
        </choice>
        <ref name="element3"/>
      </choice>
      <ref name="element4"/>
    </choice>
  </start>
  <define name="element1">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/library">library</name>
      <oneOrMore>
        <ref name="element2"/>
      </oneOrMore>
    </element>
  </define>
  <define name="element2">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/library">book</name>
      <interleave>
        <group>
          <group>
            <group>
              <group>
                <group>
                  <attribute>
                    <name ns="">id</name>
                    <text/>
                  </attribute>
                  <attribute>
                    <name ns="">available</name>
                    <choice>
                      <choice>
                        <value datatypeLibrary="" type="token" ns="TODO">true</value>
                        <value datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="token" ns="TODO"> false </value>
                      </choice>
                      <value datatypeLibrary="" type="token" ns="TODO"/>
                    </choice>
                  </attribute>
                </group>
                <ref name="element5"/>
              </group>
              <ref name="element6"/>
            </group>
            <choice>
              <empty/>
              <oneOrMore>
                <ref name="element3"/>
              </oneOrMore>
            </choice>
          </group>
          <choice>
            <empty/>
            <oneOrMore>
              <ref name="element4"/>
            </oneOrMore>
          </choice>
        </group>
        <oneOrMore>
          <choice>
            <choice>
              <empty/>
              <oneOrMore>
                <attribute>
                  <anyName>
                    <except>
                      <choice>
                        <choice>
                          <nsName ns=""/>
                          <nsName ns="http://eric.van-der-vlist.com/ns/library"/>
                        </choice>
                        <nsName ns="http://eric.van-der-vlist.com/ns/person"/>
                      </choice>
                    </except>
                  </anyName>
                  <text/>
                </attribute>
              </oneOrMore>
            </choice>
            <choice>
              <empty/>
              <oneOrMore>
                <ref name="element7"/>
              </oneOrMore>
            </choice>
          </choice>
        </oneOrMore>
      </interleave>
    </element>
  </define>
  <define name="element3">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/person">author</name>
      <group>
        <group>
          <group>
            <attribute>
              <name ns="">id</name>
              <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="NMTOKEN">
                <param name="maxLength"> 16 </param>
              </data>
            </attribute>
            <ref name="element8"/>
          </group>
          <ref name="element9"/>
        </group>
        <choice>
          <empty/>
          <ref name="element10"/>
        </choice>
      </group>
    </element>
  </define>
  <define name="element4">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/library">character</name>
      <group>
        <group>
          <group>
            <attribute>
              <name ns="">id</name>
              <text/>
            </attribute>
            <ref name="element8"/>
          </group>
          <ref name="element9"/>
        </group>
        <ref name="element11"/>
      </group>
    </element>
  </define>
  <define name="element5">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/library">isbn</name>
      <group>
        <choice>
          <empty/>
          <oneOrMore>
            <attribute>
              <anyName>
                <except>
                  <choice>
                    <choice>
                      <nsName ns=""/>
                      <nsName ns="http://eric.van-der-vlist.com/ns/library"/>
                    </choice>
                    <nsName ns="http://eric.van-der-vlist.com/ns/person"/>
                  </choice>
                </except>
              </anyName>
              <text/>
            </attribute>
          </oneOrMore>
        </choice>
        <data datatypeLibrary="" type="token"/>
      </group>
    </element>
  </define>
  <define name="element6">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/library">title</name>
      <group>
        <choice>
          <empty/>
          <oneOrMore>
            <attribute>
              <anyName>
                <except>
                  <choice>
                    <choice>
                      <nsName ns=""/>
                      <nsName ns="http://eric.van-der-vlist.com/ns/library"/>
                    </choice>
                    <nsName ns="http://eric.van-der-vlist.com/ns/person"/>
                  </choice>
                </except>
              </anyName>
              <text/>
            </attribute>
          </oneOrMore>
        </choice>
        <text/>
      </group>
    </element>
  </define>
  <define name="element7">
    <element>
      <anyName>
        <except>
          <choice>
            <choice>
              <nsName ns=""/>
              <nsName ns="http://eric.van-der-vlist.com/ns/library"/>
            </choice>
            <nsName ns="http://eric.van-der-vlist.com/ns/person"/>
          </choice>
        </except>
      </anyName>
      <oneOrMore>
        <choice>
          <choice>
            <ref name="element12"/>
            <attribute>
              <anyName/>
              <text/>
            </attribute>
          </choice>
          <text/>
        </choice>
      </oneOrMore>
    </element>
  </define>
  <define name="element8">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/person">name</name>
      <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="token"/>
    </element>
  </define>
  <define name="element9">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/person">born</name>
      <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="date"/>
    </element>
  </define>
  <define name="element10">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/person">dead</name>
      <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="date"/>
    </element>
  </define>
  <define name="element11">
    <element>
      <name ns="http://eric.van-der-vlist.com/ns/library">qualification</name>
      <text/>
    </element>
  </define>
  <define name="element12">
    <element>
      <anyName/>
      <oneOrMore>
        <choice>
          <choice>
            <ref name="element12"/>
            <attribute>
              <anyName/>
              <text/>
            </attribute>
          </choice>
          <text/>
        </choice>
      </oneOrMore>
    </element>
  </define>
</grammar>
